package com.company.learnjpa.model.repository;

import com.company.learnjpa.model.entity.Blog;
import jakarta.ejb.Stateless;
import java.util.List;

/**
 *
 * @author xiaolei
 */
@Stateless
public class BlogRepository extends GenericRepository<Blog, Long> {

    public BlogRepository() {
        super(Blog.class);
    }

    public List<String> getAllCategories() {
        String jpql = "SELECT b.category DISTICNT FROM Blog b ORDER BY b.category";
        return entityManager
                .createQuery(jpql, String.class)
                .getResultList();
    }
}
